<template>
  <dt-modal-edit ref='edit' :title='title' :label-width='130' :width='500' @ok='onOk'>
  </dt-modal-edit>
</template>

<script>
import createPresonOpt from '../opt/createPreson.js'
import incentiveMgr from '@/biz/bonus/incentive'
export default {
  data() {
    return {
      info: {
        workNo: '',
        roomId: '',
        bonusMoney: '',
        productId: '',
        buildingId: '',
        unitId: '',
      },
      title: '新增',
    }
  },
  mounted() {},
  methods: {
    create() {
      this.info = {
        workNo: '',
        roomId: '',
        bonusMoney: null,
        productId: '',
        buildingId: '',
        unitId: '',
      }
      this.$refs.edit.show(createPresonOpt.options(this), this.info)
    },
    hide() {
      this.$refs.edit.hide()
    },
    onOk() {
      console.log(this.info, 'infof')
      let params = {
        // roomId: this.info.roomId,
        workNo: this.info.workNo,
        bonusMoney: this.info.bonusMoney,
        headerId: this.$route.query.headerId,
      }
      if (this.info.roomId) {
        params.roomId = this.info.roomId
      }
      incentiveMgr.saveBonusStimulateDetail(params).then((res) => {
        console.log(res, '22222222222220000')
        if (res) {
          this.$emit('success')
          this.hide()
        }
      })
      // this.$emit('success', 1)
    },
  },
}
</script>

<style>
</style>
